package com.zf.seata.seataorder.feign;

import com.zf.common.core.result.RestResponse;
import com.zf.seata.seataorder.feign.fallback.StorageFeignFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 远程调用 storage 服务：
 *  RequestMapping 注解不能和 FeignClient注解同时使用，可以使用 FeignClient 的 path属性 替代 RequestMapping
 */
@FeignClient(value = "seata-storage", path = "/storage", contextId = "seata-storage", fallbackFactory = StorageFeignFallbackFactory.class)
public interface StorageFeign {

    @PostMapping("/changeStorage")
    RestResponse<?> changeStorage(@RequestParam(name = "id") Long id, @RequestParam("num") Integer num) throws Throwable;
}
